export default {
  props: {
    config: {
      type: Object,
    },
    id: {
      type: String,
    },
    location: {
      type: Object,
    },
  },
  inject: ["pubsub"],
  data() {
    return {
      baseUrl: process.env.VUE_APP_BASE_URL,
      currentUrl: process.env.VUE_APP_CURRENT_URL,
    };
  },
  mounted: function () {
    this.init();
    this.pubsub.subscribe("PUT_DATA", (name, id) => {
      if (id === this.id) {
        this.update();
      }
    });
    this.pubsub.subscribe("PUT_OPTION", (name, id) => {
      if (id === this.id) {
        this.update();
      }
    });
    this.pubsub.subscribe("PUT_RESIZE", (name, data) => {
      console.log(name, data);
      if (data === this.id) {
        this.resize();
      }
    });
  },
  beforeUnmount() {
    this.destroy();
  },
  methods: {
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    init: function () {},
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    update: function () {},
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    resize: function () {},
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    destroy: function () {},
  },
};
